#include "comm.hpp"

int main()
{
    key_t k = getKey();
    printf("0x%x\n",k);
    int shmid = getShm(k);
    printf("shmid:%d\n",shmid);

    sleep(5);
    char* start = (char*)attchShm(shmid);

    const char* message = "hello server,我是另一个进程";
    pid_t id = getpid();
    int cnt = 1;
    //char* buffer[1024];
    while(true)
    {
        snprintf(start,MAX_SIZE,"%s[pid:%d][消息编号%d]",message,id,cnt);
        //snprintf(buffer,sizeof(buffer),"%s[pid:%d][消息编号%d]",message,id,cnt);
        //memcpy(start,buffer,strlen(buffer)+1);
        // pid,count,mess
    }
    

    detachShm(start);
    return 0;
}